// 这个是存储订单的数据库
const mongoose = require('mongoose')

const Schema = mongoose.Schema

mongoose.connect("mongodb://localhost/shopUser", { useNewUrlParser: true })

const orderSchema = new Schema({
    orderGet:{
        type: String,
        required: true
    },
    orderUName:{
        type: String,
        required: true
    },
    orderSName:{
        type: String,
        required: true
    },
    otherOrderId:{
        type: String,
        required: true
    },
    orderId: {
        type: String,
        required: true
    },
    isCommit:{
        type: Boolean,
        required: true
    }, 
    oFlag: {
        type: String,
        required: true
    },

    //订单的状态
    orderFlow:{
        type: Number,
        required: true
    },
    //退款理由
    orderRefundCommit:{
        type: String,
        required: true
    },

    //用来标志订单完成与否
    orderState: {
        type: Number,
        required: true
    },
    shopOrder: {
        type: Object,
        required: true
    }    
})

module.exports = mongoose.model('orderInfo', orderSchema)